package com.ruge.config;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

@SpringBootConfiguration
public class FreemarkerConfig {

    @Bean
    public FreeMarkerConfigurer freeMarkerConfigurer() {
        /**
         * 模板实际位置	                配置 templateLoaderPath	    代码中引用路径
         * resources/ftl/Model.ftlh	    classpath:/ftl/	            Model.ftlh
         * resources/templates/ftl/	    classpath:/templates/	    ftl/Model.ftlh
         * resources/freemarker/	    classpath:/freemarker/	    Model.ftlh
         */
        FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
        configurer.setTemplateLoaderPath("classpath:/templates/");
        return configurer;
    }
}
